﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[spBkp_GetFullBackupName]
#-- Purpose:		Gets the full file name/path for a full backup.
#--	Last Update:	08/02/2012
#--					For a complete history - please review comments in Version
#--					Control.
#-- Called By:		[dbo].[spBkp_Full]
#------------------------------------------------------------------------------
*/
CREATE PROCEDURE [dbo].[spBkp_GetFullBackupName]
(
	@database_name				sysname,
	@backup_directory_name		varchar(2000)		OUTPUT
)
AS
BEGIN
	--- Declare Local Variables
	DECLARE	@dated_backup varchar(2000), @file_name varchar(2000)

	--- Determine the Backup Part names
	EXEC	[dbo].[spBkp_GetDirectory]	@database_name = @database_name, 
										@backup_directory_name = @backup_directory_name OUTPUT	
	SELECT	@dated_backup = REPLACE(REPLACE(REPLACE(CONVERT(varchar(50), GETDATE(), 120), '-', ''), ':' , ''), ' ' , ''),
			@file_name = @database_name + '_db_' + @dated_backup + '.bak'

	--- Return the name of the Backup File
	SELECT	@backup_directory_name = CAST(@backup_directory_name + @file_name as varchar(2000))
END
